package com.pm.web.controller.common;


import com.alibaba.fastjson2.JSONObject;
import com.pm.common.OAService;
import com.pm.common.annotation.DataSource;
import com.pm.common.annotation.Log;
import com.pm.common.core.controller.BaseController;
import com.pm.common.core.domain.AjaxResult;
import com.pm.common.core.page.TableDataInfo;
import com.pm.common.enums.BusinessType;
import com.pm.common.enums.DataSourceType;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/common/oa")
public class OAController  extends BaseController {


    @Resource
    OAService oaService;

    /**
     * 单点查看OA表单
     * @param oaId
     * @return
     */
    @GetMapping("/sign/loginToEkp")
    @Log(title = "OA:单点访问OA",businessType = BusinessType.OTHER)
    public AjaxResult signLoginToEkp(String oaId)
    {
        return  oaService.signLoginToEkp(oaId);
    }

    /**
     * 单点查看OA表单
     * @param url
     * @return
     */
    @GetMapping("/sign/loginToEkpUrl")
    @Log(title = "OA:单点访问OA",businessType = BusinessType.OTHER)
    public AjaxResult signLoginToEkpUrl(String url)
    {
        return  oaService.signLoginToEkpUrl(url);
    }



    /**
     * 查询PRD流程数据
     * @return
     */
    @PostMapping("/queryPRDList")
    @Log(title = "OA:查询PRD流程数据",businessType = BusinessType.OTHER)
    @DataSource(DataSourceType.OA)
    public TableDataInfo queryPRDList(@RequestBody JSONObject param)
    {

        startPage();
        List<JSONObject> list = oaService.queryPRDList(param);
        return getDataTable(list);

    }

    /**
     * 查询PRD流程的提交人列表
     * @return
     */
    @GetMapping("/queryPRDUserList")
    @Log(title = "OA:查询PRD流程的提交人列表",businessType = BusinessType.OTHER)
    public AjaxResult queryPRDUserList()
    {
        return  oaService.queryPRDUserList();
    }



}
